import numpy as np
a = np.array([[0, 0, 0, 1/3,0, 0],
			[1/4, 0, 0, 0,1/2, 0],
			[0, 1, 0, 1/3,1/2, 0],
			[1/4, 0, 0, 0, 0, 1],
            [1/4, 0, 1, 1/4, 0, 0],
            [1/4, 0, 0, 0,0, 0 ]])


b = np.array([1/4, 1/4, 1/4, 1/4, 1/4, 1/4])
w = b

def work(a, w):
	for i in range(100):
		w = np.dot(a, w)
		print(w)

def random_work(a, w, n):
	d = 0.85
	for i in range(100):
		w = (1-d)/n + d*np.dot(a, w)
		print(w)

print('简化模型的PR值：')
work(a, w)
#[2.21867130e-31 2.87500000e-01 5.75000000e-01 3.32800695e-31 5.75000000e-01 1.10933565e-31]
print("随机模型的PR值：")
random_work(a, w, a.shape[0])
#[0.04288042 0.17328562 0.32934673 0.06310737 0.32746712 0.03411209]
